define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'chao.change_order/index',
        delete_url: 'chao.change_order/delete',
        export_url: 'chao.change_order/export',
        modify_url: 'chao.change_order/modify',
        change_order_review: 'chao.change_order/change_order_review',
        change_order_refuse: 'chao.change_order/change_order_refuse',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar: ['refresh'],
                cols: [[
                    {field: 'order_no', width: 200, title: '订单编号'},
                    {field: 'consignee', title: '收货人'},
                    {field: 'kahuna_name', title: '负责人'},
                    {field: 'courier_number', title: '快递单号'},
                    {field: 'order_bottom_price', title: '最低价'},
                    {field: 'amount_collected', title: '收款金额'},
                    {field: 'contact_phone', title: '联系电话',search: false},
                    {field: 'status', title: '状态', selectList: {1: '未下单',2: '待审核',3: '通过',4: '驳回',5: '预约成功',5: '已退款',6: '出库完成',7: '取消',8: '已作废'}},
                    {field: 'collection_voucher', title: '收款凭证'},
                    {field: 'reason', title: '驳回原因',search: false},
                    {field: 'is_cooperate', title: '是否合作快递', selectList: {1: '是',2: '否'}},
                    {title: '操作', templet: ea.table.tool,operat:[
                      [
                          {
                              text: '通过',
                              title: '确定通过吗？',
                              url: init.change_order_review,
                              method: 'request',
                              auth: 'edit',
                              class: 'layui-btn layui-btn-xs layui-btn-success',
                              extend: 'data-full="true"',
                          }
                     ],
                     [
                         {
                            text: '驳回',
                            url: init.change_order_refuse,
                            method: 'open',
                            auth: 'edit',
                            class: 'layui-btn layui-btn-xs layui-btn-danger'
                        }
                    ]
                    ]},
                ]],
            });
            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
        ord_detail: function () {
            ea.listen();
        },
        change_order_refuse: function () {
            ea.listen();
        }
    };
    return Controller;
});